<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="PersonaEditDlg" widgetVar="PersonaEditDialog" modal="true" resizable="false" appendTo="@(body)" header="#{bundle.EditPersonaTitle}">
            <h:form id="PersonaEditForm">
                <h:panelGroup id="display">
                    <p:panelGrid columns="2" rendered="#{personaController.selected != null}">
                        <p:outputLabel value="#{bundle.EditPersonaLabel_idPersona}" for="idPersona" />
                        <p:inputText id="idPersona" value="#{personaController.selected.idPersona}" title="#{bundle.EditPersonaTitle_idPersona}" required="true" requiredMessage="#{bundle.EditPersonaRequiredMessage_idPersona}"/>
                        <p:outputLabel value="#{bundle.EditPersonaLabel_cedula}" for="cedula" />
                        <p:inputText id="cedula" value="#{personaController.selected.cedula}" title="#{bundle.EditPersonaTitle_cedula}" />
                        <p:outputLabel value="#{bundle.EditPersonaLabel_nombre}" for="nombre" />
                        <p:inputText id="nombre" value="#{personaController.selected.nombre}" title="#{bundle.EditPersonaTitle_nombre}" />
                        <p:outputLabel value="#{bundle.EditPersonaLabel_idCargo}" for="idCargo" />
                        <p:selectOneMenu id="idCargo" value="#{personaController.selected.idCargo}" required="true" requiredMessage="#{bundle.EditPersonaRequiredMessage_idCargo}">
                            <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                            <f:selectItems value="#{cargoController.itemsAvailableSelectOne}"
                                           var="idCargoItem"
                                           itemValue="#{idCargoItem}"/>
                        </p:selectOneMenu>
                        <p:outputLabel value="#{bundle.EditPersonaLabel_usuario}" for="usuario" />
                        <p:selectOneMenu id="usuario" value="#{personaController.selected.usuario}" >
                            <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                            <f:selectItems value="#{usuarioController.itemsAvailableSelectOne}"
                                           var="usuarioItem"
                                           itemValue="#{usuarioItem}"/>
                        </p:selectOneMenu>
                    </p:panelGrid>
                    <p:commandButton style="height: 75px;
                                     width: 75px;
                                     background-image: url(../img/fondo-boton.png);
                                     background-size: 75px;
                                     border-radius: 50px;
                                     color:#ffffff"
                                     icon="ui-icon-disk"
                                     actionListener="#{personaController.update}" title="Guardar" update="display,:PersonaListForm:datalist,:growl" oncomplete="handleSubmit(args, 'PersonaEditDialog');"/>
                    <p:commandButton style="height: 75px;
                                     width: 75px;
                                     background-image: url(../img/fondo-boton.png);
                                     background-size: 75px;
                                     border-radius: 50px;
                                     color:#ffffff"
                                     icon="ui-icon-close"
                                     value="Cancelar" onclick="PersonaEditDialog.hide()"/>
                </h:panelGroup>
            </h:form>
        </p:dialog>

    </ui:composition>
</html>
